package com.survey.Controller;

import com.survey.pojo.data.SurveyDO;
import com.survey.pojo.vo.JJOption;
import com.survey.pojo.vo.StatisData;
import com.survey.pojo.vo.StatisticsData;
import com.survey.pojo.vo.SurveyVO;
import com.survey.service.ResultService;
import com.survey.service.SurveyService;
import jdk.nashorn.internal.objects.NativeUint8Array;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 统计问卷
 */
@Controller
public class StatisticsResultController {
    @Autowired
    private ResultService resultService;
    @Autowired
    private SurveyService surveyService;
    @RequestMapping("/statistics/do")
    public String d1(Integer sid, Model model, HttpSession session) throws Exception {
        //获取问卷的名字
        SurveyVO surveyVO=new SurveyVO();
        surveyVO.setId(sid);
        SurveyDO detailSurvey = surveyService.findDetailSurvey(surveyVO);
        model.addAttribute("detailSurvey",detailSurvey.getName());
        //根据试卷id获得题目信息
        List<JJOption> data=resultService.getQuestionInfo(sid);
        model.addAttribute("data",data);
        return "/admin/SurveyStatisShow.jsp";
    }

}
